cmake_minimum_required(VERSION 3.21)

# setting
project(rmnl)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# srcs
include_directories(src/base)
include_directories(src/epoll)
include_directories(src/io_uring)
include_directories(deps)
file(GLOB_RECURSE SRC_LIST "src/base/*.cc" "src/epoll/*.cc" "src/io_uring/*.cc")
file(GLOB_RECURSE HDR_LIST "src/base/*.cc" "src/epoll/*.cc" "src/io_uring/*.cc")
add_subdirectory(example)

# add_subdirectory(test)

# build
include(cmake/utils.cmake)
add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE)
add_library(rmnl SHARED ${SRC_LIST})
target_link_libraries(rmnl PUBLIC uring)
redefine_file_macro(rmnl)

# install
install(TARGETS rmnl
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
)
install(FILES ${HDR_LIST} DESTINATION "include/rmnl")
